package com.aeye.mbr.upms.dto;

import java.io.Serializable;


public class BaseDto extends BaseRequest  implements Serializable{
	/**
	 * serialVersionUID:TODO(用一句话描述这个变量表示什么 )by shengpeng.
	 * @since JDK 1.6
	 */
	private static final long serialVersionUID = -1964638186475920387L;
	
/*
	//判断两个dto在系统中是不是属于同样的，如果是一样的，就不需要更新等等
	public boolean sameWith(Object other){ 
		if(null == other) return false;
		try
		{
			final BeanWrapper otherBean = new BeanWrapperImpl(other);
			BeanWrapper own = new BeanWrapperImpl(this);
			java.beans.PropertyDescriptor[] otherPds = otherBean.getPropertyDescriptors();
			java.beans.PropertyDescriptor[] ownPds = own.getPropertyDescriptors();

			if(otherPds.length != ownPds.length)
			{
				return false;
			}
			
		    for(java.beans.PropertyDescriptor pd : otherPds) {
		        Object srcValue = otherBean.getPropertyValue(pd.getName());
		        Object ownValue = own.getPropertyValue(pd.getName());
		        if(!isSamePropertyValue(srcValue,ownValue))
		        {
		        	return false;
		        }
		    }
			return true;
		}catch(Exception e)
		{
			e.printStackTrace();
		}
		return false;
	}

	private boolean isSamePropertyValue(Object srcValue, Object ownValue) {
		if(null == srcValue && null == ownValue)
		{
			return true;
		}else
		{
			if(null != srcValue && null != ownValue)
			{
				return srcValue.equals(ownValue);
			}else
			{
				return false;
			}
		}
	}
	
	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		BeanWrapper own = new BeanWrapperImpl(this);
		java.beans.PropertyDescriptor[] ownPds = own.getPropertyDescriptors();
		for(java.beans.PropertyDescriptor pd : ownPds) {
			try
			{
		        Object ownValue = own.getPropertyValue(pd.getName());
		        if(null != ownValue)
		        {
		        	sb.append(pd.getName()+":"+ownValue.toString()+",");
		        }else{
		        	sb.append(pd.getName()+":null,");
		        }
			}catch(Exception e)
			{
				e.printStackTrace();
			}
		}
		return sb.toString();
	}*/
}
